home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / fortran / toolpack.000 / toolpack / toolpack1.2 / util / char2.c next >
Encoding:
C/C++ Source or Header  |  1989-03-04  |  417 b   |  22 lines

  1. #include <stdio.h>
  2.  
  3. main(argc, argv)
  4.  
  5. /* Compiles into char2  */
  6. /* Prints the second character of the first command line argument */
  7. /* on standard output.  Used in scripts to get a "key" from an "option" */
  8. /* that is indicated by first character '-' . */
  9.  
  10. int argc;
  11. char *argv[];
  12.  
  13. {
  14. char c;
  15.  
  16. c = (*++argv)[1];
  17. if (c == '\n' || c == '\0')
  18.     printf("Fewer than two characters in string.\n");
  19. else
  20.     printf("%c", c);
  21. }
  22.